package org.liuqm.controller;


import org.liuqm.common.AjaxResult;
import org.liuqm.common.RequestMapping;
import org.liuqm.entity.Auctionuser;
import org.liuqm.service.IAuctionuserService;
import org.liuqm.service.impl.AuctionuserServiceImpl;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@RequestMapping("/auth")
public class LoginServlet {

    IAuctionuserService auctionuserService = new AuctionuserServiceImpl();

    @RequestMapping("/login")
    public AjaxResult login(HttpServletRequest request, HttpServletResponse response) {
        String username=request.getParameter("username");
        String password=request.getParameter("password");
       Auctionuser auctionuser= auctionuserService.login(username,password);
        AjaxResult ajaxResult=new AjaxResult();
       if(auctionuser!=null){
           ajaxResult.setCode(200);
           ajaxResult.setResult(auctionuser);
       }else{
           ajaxResult.setCode(500);
           ajaxResult.setMsg("账号或密码错误！");
       }

      return ajaxResult;

    }



}
